package p2p.gui;

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;

import p2p.simulation.GraphUpdater;

import edu.uci.ics.jung.visualization.BasicVisualizationServer;

public class P2PWindow extends JFrame {
	
	private static P2PWindow instance;
	private Menubar menubar;
	private JPanel graphPanel;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private P2PWindow(){
		
		this.setUp();
		
	}
	
	public static P2PWindow getInstance(){
		if (instance == null)
			instance = new P2PWindow();
		return instance;
	}
	
	private void setUp(){
		
		this.setJMenuBar(new Menubar());
		this.configWindow();
	
	}
	
	private void configWindow(){
		
		this.setVisible(true);
		this.setSize(new Dimension(800,600));
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
	
	}
	
	public void setGraphVisualisation(BasicVisualizationServer<String, String> graphVis){
		if (graphPanel == null){
			graphPanel = new JPanel();
		}
		this.getContentPane().add(graphVis);
		this.getContentPane().validate();
	}

	

}
